package com.olinsports.system.olinsportssystem.controller;

import com.olinsports.system.olinsportssystem.manager.CommodityTypeManager;
import com.olinsports.system.olinsportssystem.model.CommodityType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2017/7/22.
 */
@Controller
@RequestMapping("commodityType")
public class CommodityTypeController {
    @Autowired
    private CommodityTypeManager commodityTypeManager;

    @RequestMapping("/selectAll")
    @ResponseBody
    public List<CommodityType> selectAll(){
        return commodityTypeManager.selectAll();
    }

    @RequestMapping("/insertAll")
    @ResponseBody
    public int insertAll(CommodityType commodityType){
        return commodityTypeManager.insertAll(commodityType);
    }

    @RequestMapping("/deleteByKey")
    @ResponseBody
    public int deleteByKey(int typeKey){
        return commodityTypeManager.deleteByKey(typeKey);
    }

    @RequestMapping("/listType")
    @ResponseBody
    public Map listType(String page, String rows, String sord, String sidx){
        return commodityTypeManager.listType(page,rows,sord,sidx);
    }
}
